package splash.core.security;

import splash.core.Util;

public class User
{
	private String username;
	private String password;
        private RestrictionSet restrictions;
	
	public User(String username, String password)
	{
		this.username = username;
		this.password = Util.sha(password);
	}
	
	public User(String username, String password, boolean ph)
	{
		this.username = username;
		
		/* Password already hashed */
		if(!ph) 
			this.password = Util.sha(password);
		else
			this.password = password;
	}

        public User(String username, String password, RestrictionSet rs , boolean ph)
	{
		this.username = username;

		/* Password already hashed */
		if(!ph)
			this.password = Util.sha(password);
		else
			this.password = password;

                this.restrictions = rs;
	}
	
	public String getUsername()
	{
		return this.username;
	}
	
	public String getPassword()
	{
		return this.password;
	}

        public RestrictionSet getRestrictions()
        {
            return this.restrictions;
        }

        @Override
        public boolean equals(Object o)
        {
//            return (((User)o).getUsername().equals(this.username) &&
//                    ((User)o).getPassword().equals(this.password));

            return ((User)o).getUsername().equals(this.username);
        }

}
